<SCRIPT language="JavaScript" type="text/javascript">     

    function tampil() {
        $("#hint").fadeIn("slow");
    }
    function sembunyi() {
        $("#hint").fadeOut("slow");
    }  

    function validation()
    {
        
        var temp = document.getElementById('exp');
        if(isNaN(temp.value))
        {
            temp.focus();
            temp.style.backgroundColor='#FF9';
            alert('Please fill the year experience with numeric value');
            temp.style.backgroundColor='#FFF';
            return false;
        }
    }
    
 
    function change(temp)
    {
        if(temp.id=='keyword')
        { document.getElementById('hdnkeyword').value = temp.value; }
        if(temp.id=='match')
        { document.getElementById('hdnmatch').value = temp.value; }
        if(temp.id=='search')
        { document.getElementById('hdnsearch').value = temp.value; }
    }
    
    function reset()
    {
        document.getElementById('keyword').value='';
        document.getElementById('match1').checked=true;
        document.getElementById('search1').checked=true;
        
        document.getElementById('hdnkeyword').value='';
        document.getElementById('hdnmatch').value=0;
        document.getElementById('hdnsearch').value=0;
        
        document.getElementById('city').value=0;
        document.getElementById('field').value=0;
        document.getElementById('entry').checked=false;
        document.getElementById('middle').checked=false;
        document.getElementById('senior').checked=false;
        document.getElementById('top').checked=false;
        
        document.getElementById('academic').value=0;
        document.getElementById('academic1').value=0;
        
        document.getElementById('exp').value='0';
        document.getElementById('exp1').value=1;
        
        document.getElementById('parttime').checked=false;        
        document.getElementById('fulltime').checked=false;        
        document.getElementById('temporary').checked=false;        
        document.getElementById('contract').checked=false;        
        document.getElementById('freelance').checked=false;        

        document.getElementById('salary').value=0;
        document.getElementById('salary1').checked=true;
    }

</SCRIPT>

<?php
   //$cities = $this->requestAction(array('controller'=>'cities','action'=>'mylist'));
   //$fields = $this->requestAction(array('controller'=>'fields','action'=>'mylist'));
   //$academics = $this->requestAction(array('controller'=>'academics','action'=>'mylist'));
e($javascript->link('jquery.js'));    
echo "<div class='form'>";   

    echo "<h2> Specific Jobs Search </h2>";
    echo "<hr color='#2A7EF7'>";
    
    echo "<div class='kotak'>";
    echo $form->create('Job',array('action'=>'search_result'));
        echo "<div class='input'>";
        echo "<label class='left'>Keyword(s)</label><input type='text' id='keyword' name='keyword' onchange='change(this);' size='40'> ";
        echo " <img src='../img/hint.gif' onmouseover='tampil();' onmouseout='sembunyi();'>";  
?>
<div id='hint' style='left:526px;display:none'>
<b>Keyword(s) Tip</b><br>&nbsp - Fill blank if you don't care <br>&nbsp - For more than one word, use coma (,) to seperate them
</div>        
<?php
        echo "&nbsp<input type='submit' value='Search' name='bykeyword2'>";
        echo "</div>";
        echo "<div class='input'>";
        echo "<label>&nbsp</label>Match : ";
        echo " <input type='radio' name='match' id='match1' value='0' checked='true' onchange='change(this);'> Any of these words(OR) ";
        echo " <input type='radio' name='match' id='match2' value='1' onchange='change(this);'> All of therse words (AND)";
        echo "<br>";
        echo "<label>&nbsp</label>Search : ";
        echo "<input type='radio' name='search' id='search1' value='0' checked='true' onchange='change(this);'> Position ";
        echo "<input type='radio' name='search' id='search3' value='2' onchange='change(this);'> All Text ";
        echo "<input type='radio' name='search' id='search2' value='1' onchange='change(this);'> Company ";
        echo "</div>"; 
        
    echo "</form>";
    
    echo $form->create('Job',array('action'=>'search_result','onsubmit'=>'return validation();'));
        echo "<input type='hidden' id='hdnkeyword' name='keyword' value=''>";
        echo "<input type='hidden' id='hdnmatch' name='match' value='0'>";
        echo "<input type='hidden' id='hdnsearch' name='search' value='0'>";
        
        echo "<div class='input'>";
        echo "<label class='left'>Location</label>";
        echo "<select name='city' id='city'> <option value='0'> (Any)</option>";
        foreach($cities as $city)
        {
            echo "<option value=".$city['City']['id'].">".$city['City']['name']."</option>";
        }
        echo "</select>";
        echo "</div>";

        echo "<div class='input'>";
        echo "<label class='left'>Category</label>";
        echo "<select name='field' id='field'> <option value='0'> (Any) </option>";
        foreach($fields as $field)
        {
            echo "<option value=".$field['Field']['id'].">".$field['Field']['name']."</option>";
        }
        echo "</select>";
        echo "</div>";
        
        echo "<div class='input'>";
        echo "<label class='left'>Career Level</label>";
            echo "<input type='checkbox' name='entry' id='entry' > Entry Level ";
            echo " <input type='checkbox' name='middle' id='middle'> Middle ";
            echo " <input type='checkbox' name='senior' id='senior'> Senior ";
            echo " <input type='checkbox' name='top' id='top'> Top ";
        echo "</div>";
        
        echo "<div class='input'>";
        echo "<label class='left'>Academic Qualification</label>";
        echo "<select name='academic' id='academic'> <option value='0'> (Any) </option>";
        foreach($academics as $academic)
        {
            echo "<option value=".$academic['Academic']['id'].">".$academic['Academic']['name']."</option>";
        }
        echo "</select> <select name='academic1' id='academic1'> <option value='0'> Exactly </option> <option value='1'> Above </option> <option value='2'> Below </option> </select>";
        echo "</div>";
        
        echo "<div class='input'>";
        echo "<label class='left'>Years Experience</label>"; 
        echo "<input type='text' name='exp' id='exp' size='2' maxlength='2' value='0'> <select name='exp1' id='exp1'> <option value='0'> Exactly </option> <option value='1' selected> Above </option> <option value='2'> Below </option> </select>";
        echo "</div>";
        
        echo "<div class='input'>";
        echo "<label class='left'>Employment Term </label>";
            echo "<input type='checkbox' name='parttime' id='parttime' > Parttime ";
            echo " <input type='checkbox' name='freelance' id='freelance' > Freelance ";
            echo " <input type='checkbox' name='fulltime' id='fulltime' > Fulltime ";
            echo " <input type='checkbox' name='contract' id='contract' > Contract ";                
            echo " <input type='checkbox' name='temporary' id='temporary' > Temporary ";    
        echo "</div>";
        
        echo "<div class='input'>";
        echo "<label class='left'> Salary </label>";
        echo "<select name='salary' id='salary'>";
            echo "<option value=0>- Any -</option>";
            echo "<option value=1>".SALARY_1."</option>";
            echo "<option value=2>".SALARY_2."</option>";
            echo "<option value=3>".SALARY_3."</option>";
            echo "<option value=4>".SALARY_4."</option>";
        echo "</select>";
        echo "<br><input type='checkbox' name='salary1' id='salary1' checked> Include Negotiable salary";
        echo "</div>";
        
        echo "<div class='input'><label class='left'><a href='Javascript:reset();'>[ Reset ]</a></label><input type='submit' value='Search' name='byall'></center></div>"; 
    echo "</form>"; 
    echo "</div>";
    echo ":. Click ".$html->link('[ Here ]',array('controller'=>'jobs','action'=>'search_result','by'=>'all'))." to browse all jobs";
echo "</div>"; 
?>
